# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=loki-scanner
pkgver=1255.687e211
pkgrel=3
pkgdesc='Simple IOC and Incident Response Scanner.'
groups=('blackarch' 'blackarch-forensic' 'blackarch-scanner')
arch=('any')
url='https://github.com/Neo23x0/Loki'
license=('GPL3')
depends=('python2' 'python2-colorama' 'python2-psutil' 'python2-yara'
         'python2-pylzma' 'python2-pycurl' 'python2-simplejson' 'python2-pytz'
         'python2-requests' 'python2-argparse' 'python2-ipy' 'python2-netaddr'
         'python2-beautifulsoup4' 'python2-pycryptodome' 'python2-tzlocal'
         'python2-rfc5424-logging-handler' 'python2-helpers')
makedepends=('git')
source=("$pkgname::git+https://github.com/Neo23x0/Loki.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  rm LICENSE README.md build.bat requirements.txt

  cp -a --no-preserve=ownership * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python2 loki.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

